package com.thirdgroup.controller;

import com.alibaba.fastjson.JSONObject;
import com.thirdgroup.controller.base.BaseServlet;
import com.thirdgroup.service.CompanyService;
import com.thirdgroup.service.impl.CompanyServiceImpl;
import com.thirdgroup.utils.respond.R;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/company/*")
public class CompanyServlet extends BaseServlet {
    private CompanyService companyService=new CompanyServiceImpl();
    public void select(HttpServletRequest request, HttpServletResponse response) throws IOException {
        request.setCharacterEncoding("UTF-8");
        response.setContentType("application/json;charset=utf-8");
        R r = companyService.select();
        System.out.println("获取了公司数据及更新总资产  ");
        System.out.println(r.getData());
        response.getWriter().write(JSONObject.toJSONString(r));
        response.getWriter().flush();
        response.getWriter().close();
    }

}
